﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PresentationNamespace;

namespace UI
{
    public partial class UIView : Form, IStackView
    {

        public string stackState
        {

            set
            {
                stackStateTextBox.Text = value;
            }
        }
        public string addItemField
        {
            get
            {
                return addNewItemTextBox.Text;
            }
            set
            {
                addNewItemTextBox.Text = value;
            }
        }
        public string gotItemField
        {
            set
            {
                getItemTextBox.Text = value;
            }
        }
        public string errorMessage
        {
            set
            {
                errorMesageLabel.Text = value;
            }
        }
        public bool isErrorMessageVisible
        {
            get
            {
                return errorMesageLabel.Visible;
            }
            set
            {
                errorMesageLabel.Visible = value;
            }
        }
        public string logWindow
        {
            set
            {
                logTextBox.Text = value;
            }
        }
        public bool isLogPanelVisible
        {
            get
            {
                return logPanel.Visible;
            }
            set
            {
                logPanel.Visible = value;
            }
        }

        public event Action OnGetElementClick;
        public event Action OnAddElementClick;
        public event Action OnShowLogClick;
        public event Action OnSaveLogClick;
        
        public UIView()
        {
            InitializeComponent();
            new StackPresenter((IStackView)this);
        }

        private void addNewItemButton_Click(object sender, EventArgs e)
        {
            OnAddElementClick();
        }

        private void getItemButton_Click(object sender, EventArgs e)
        {
            OnGetElementClick();
        }

        private void showLogCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            OnShowLogClick();
        }

        private void saveLogButton_Click(object sender, EventArgs e)
        {
            OnSaveLogClick();
        }
    }
}
